package com.hwadee.teachingprocessmanagementsystem.dto.student;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 学生课件页面Dto
 * @Author: Jukomu
 * @Package: com.hwadee.teachingprocessmanagementsystem.dto.student
 * @Project: TeachingProcessManagementSystem
 * @name: StudentCoursewareDto
 * @Date: 2024/7/15-9:39
 * @Filename: StudentCoursewareDto
 */
@Data
public class StudentCoursewareDto implements Serializable {
    // 课程信息
    private StudentCourseInfoDto studentCourseInfoDto;
    // 文件列表
    private List<FileInfo> fileList;
    // 目录列表
    private List<PathInfo> pathList;

    /**
     * 获取文件信息对象
     *
     * @return
     */
    public FileInfo getFileInfo() {
        return new FileInfo();
    }

    /**
     * 获取目录信息对象
     *
     * @return
     */
    public PathInfo getPathInfo() {
        return new PathInfo();
    }

    /**
     * 添加一条文件列表信息
     *
     * @param fileInfo
     */
    public void addFileInfo(FileInfo fileInfo) {
        if (this.fileList == null) {
            this.fileList = new ArrayList<>();
        }
        this.fileList.add(fileInfo);
    }

    /**
     * 添加一条文件列表信息
     *
     * @param filename
     * @param fileSize
     * @param date
     * @param courseName
     * @param parentPath
     */
    public void addFileInfo(String filename, Long fileSize, String date, String courseName, String teacherName, String parentPath) {
        FileInfo fileInfo = new FileInfo(filename, fileSize, date, courseName, teacherName, parentPath);
        this.addFileInfo(fileInfo);
    }

    /**
     * 添加一条目录列表信息
     *
     * @param pathInfo
     */
    public void addPathInfo(PathInfo pathInfo) {
        if (this.pathList == null) {
            this.pathList = new ArrayList<>();
        }
        this.pathList.add(pathInfo);
    }

    /**
     * 添加一条目录列表信息
     *
     * @param pathName
     * @param date
     * @param courseName
     * @param parentPath
     */
    public void addPathInfo(String pathName, String date, String courseName, String parentPath) {
        PathInfo pathInfo = new PathInfo(pathName, date, courseName, parentPath);
        this.addPathInfo(pathInfo);
    }
}

@Data
class FileInfo implements Serializable {
    // 文件名
    private String fileName;
    // 文件大小，单位MB
    private Long fileSize;
    // 上传日期
    private String date;
    // 课程名称
    private String courseName;
    // 授课教师
    private String teacherName;
    // 父目录
    private String parentPath;

    public FileInfo() {
    }

    public FileInfo(String filename, Long fileSize, String date, String courseName, String teacherName, String parentPath) {
        this.fileName = filename;
        this.fileSize = fileSize;
        this.date = date;
        this.courseName = courseName;
        this.teacherName = teacherName;
        this.parentPath = parentPath;
    }
}

@Data
class PathInfo implements Serializable {
    // 目录名
    private String pathName;
    // 上传日期
    private String date;
    // 课程名称
    private String courseName;
    // 父目录
    private String parentPath;

    public PathInfo() {
    }

    public PathInfo(String pathName, String date, String courseName, String parentPath) {
        this.pathName = pathName;
        this.date = date;
        this.courseName = courseName;
        this.parentPath = parentPath;
    }
}